import 'package:flutter/material.dart';

class BaseContainer extends StatelessWidget {
  const BaseContainer({
    super.key,
    this.background,
    this.margin,
    this.padding,
    this.strokeWidth,
    this.strokeColor,
    this.radius,
    this.child,
    this.width,
    this.height,
    this.alignment,
    this.leftTopRadius,
    this.rightTopRadius,
    this.leftBottomRadius,
    this.rightBottomRadius,
    this.backgroundImg,
    this.click,
  });

  final Widget? child;
  final EdgeInsetsGeometry? margin;
  final EdgeInsetsGeometry? padding;
  final Color? background;
  final double? strokeWidth;
  final Color? strokeColor;
  final double? radius;
  final double? width;
  final double? height;
  final Alignment? alignment;
  final double? leftTopRadius;
  final double? rightTopRadius;
  final double? leftBottomRadius;
  final double? rightBottomRadius;
  final String? backgroundImg;
  final VoidCallback? click;

  @override
  Widget build(BuildContext context) {
    return GestureDetector(
      onTap: click,
      child: Container(
        alignment: alignment,
        width: width,
        height: height,
        child: child ?? buildChild(context),
        margin: margin,
        padding: padding,
        decoration: BoxDecoration(
          image: backgroundImg == null
              ? null
              : DecorationImage(
                  fit: BoxFit.fill,
                  image: AssetImage(backgroundImg!),
                ),
          color: backgroundImg == null ? background : null,
          borderRadius: radius != null
              ? BorderRadius.circular(radius ?? 0)
              : BorderRadius.only(
                  topLeft: Radius.circular(leftTopRadius ?? 0),
                  topRight: Radius.circular(rightTopRadius ?? 0),
                  bottomLeft: Radius.circular(leftBottomRadius ?? 0),
                  bottomRight: Radius.circular(rightBottomRadius ?? 0),
                ),
          border: Border.all(
            width: strokeWidth ?? 0,
            color: strokeColor ?? Colors.transparent,
          ),
        ),
      ),
    );
  }

  Widget? buildChild(BuildContext context) {
    return null;
  }
}
